<!DOCTYPE html>
<html lang="en" theme="dark">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title id="title">Preferences</title>
    <link rel="stylesheet" href="../assets/css/extra.css">
    <!-- Translating -->
    <script src="../src/preferences.js" defer></script>
    <script>window.i18n = new (require('../translations/i18n'));</script>
</head>

<body>
    <div id="top">
        <a id="restart">Restart app</a>
        <a id="back">Homepage</a>
    </div>

    <h1 id="preferences">Preferences</h1>
    <br><br>

    <div class="prefBox" style="border: none;">
        <strong id="dlText">Download location</strong>
    </div>

    <div class="prefBox">
        <span id="clText">Current download location - </span><span id="path"></span>
    </div>

    <button id="selectLocation" class="greenBtn">Select Download Location</button>

    <p id="msg">
    </p>

    <!-- Language -->
    <div class="prefBox">
        <label id="selectLn">Select Language (Requires reload)</label>
        <select id="select" onchange="changeLanguage()">
            <option value="en">English</option>
            <option value="de">Deutsch</option>
            <option value="es">Español</option>
            <option value="fa">فارسی</option>
            <option value="el">Ελληνικά</option>
            <option value="fr">Français</option>
            <option value="it">Italiano</option>
            <option value="ja">Japanese</option>
            <option value="hu">Magyar</option>
            <option value="pl">Polski</option>
            <option value="pt">Português</option>
            <option value="ru">Русский</option>
            <option value="fi">Finnish</option>
            <option value="uk">Українська</option>
            <option value="tr">Türkçe</option>
            <option value="vi">Vietnamese</option>
            <option value="ar">اَلْعَرَبِيَّةُ</option>
            <option value="zh">简体中文</option>
            <option value="bn">বাংলা</option>
        </select>
    </div>

    <!-- Video Quality -->
    <div class="prefBox">
        <span id="preferredVideoTxt">Preferred video quality</span>
        <select id="preferredVideoQuality">
            <option value="144">144p</option>
            <option value="240">240p</option>
            <option value="360">360p</option>
            <option value="480">480p</option>
            <option value="720">720p (HD)</option>
            <option value="1080">1080p (FHD)</option>
            <option value="1440">1440p</option>
            <option value="2160">2160p (4k)</option>
        </select>

    </div>

    <!-- Video Codec -->
    <div class="prefBox">
        <span id="preferredVideoCodecTxt">Preferred video codec</span>
        <select id="preferredVideoCodec">
            <option value="avc1">AVC1</option>
            <option value="av01">AV1</option>
            <option value="vp9">VP9</option>
            <option value="mp4v">MP4V</option>
        </select>

    </div>

    <!-- Audio format -->
    <div class="prefBox">
        <span id="preferredAudioTxt">Preferred audio format</span>
        <select id="preferredAudioQuality">
            <option value="mp3">Mp3</option>
            <option value="aac">Aac</option>
            <option value="m4a">M4a</option>
            <option value="opus">Opus</option>
            <option value="wav">Wav</option>
            <option value="alac">Alac</option>
            <option value="flac">Flac</option>
            <option value="vorbis">Vorbis (ogg)</option>
        </select>

    </div>

    <p id="flatpakTxt"></p>
    <div class="prefBox">
        <span id="browserTxt">Select browser to use cookies from</span>
        <span id="browserInfo"> ℹ️</span>
        <select id="browser">
            <option value="" id="none">None</option>
            <option value="chrome">Chrome</option>
            <option value="firefox">Firefox</option>
            <option value="brave">Brave</option>
            <option value="opera">Opera Mini</option>
            <option value="edge">Edge</option>
            <option value="chromium">Chromium</option>
            <option value="safari">Safari</option>
            <option value="vivaldi">Vivaldi</option>
        </select>
    </div>

    <div class="prefBox">
        <span id="proxyTitle">Proxy</span>
        <input type="text" id="proxyTxt" placeholder="Example: http://localhost:8080" pattern="^(http:\/\/|https:\/\/|socks5:\/\/)?[a-zA-Z0-9.]+:[\d]+$">
    </div>

    <div id="pathConfig">

        <div class="configBox">
            <span id="configTxt">Use configuration file</span>
            <input type="checkbox" class="cb" id="configCheck">
        </div>

        <div id="configOpts">
            <br>
            <button class="greenBtn" id="configBtn">Select config file</button>
            <br>
            <strong id="configPathTxt">Path:</strong>
            <span id="configPath"></span>
        </div>
    </div>

    <div class="prefBox">
        <span id="showMoreFormatsTxt">Show more format options</span>
        <input type="checkbox" class="cb" id="showMoreFormats">
    </div>

    <div class="prefBox">
        <span id="fileFormatTxt">Filename format for playlists</span>
        <input type="text" id="filenameFormat" placeholder="yt-dlp format style"
            value="%(playlist_index)s.%(title)s.%(ext)s">
        <button class="redBtn" id="resetFilenameFormat">Reset to default</button>
    </div>

    <div class="prefBox">
        <span id="dirFormatTxt">Folder name format for playlists</span>
        <input type="text" id="foldernameFormat" value="%(playlist_title)s" placeholder="yt-dlp format style">
        <button class="redBtn" id="resetFoldernameFormat">Reset to default</button>
    </div>


    <div class="prefBox">
        <span id="maxTxt">Maximum number of active downloads</span>
        <input type="number" min="1" class="input" id="maxDownloads" value="5">
    </div>


    <div class="prefBox">
        <span id="trayTxt">Close to system tray</span>
        <input type="checkbox" class="cb" id="closeToTray">
    </div>
    
    <div class="prefBox" id="autoUpdatesBox">
        <span id="autoUpdateTxt">Disable auto updates</span>
        <input type="checkbox" class="cb" id="autoUpdateDisabled">
    </div>
</body>

</html>